using System;

namespace Entities
{
	public class ChaseAction : MobAction
	{
		public ChaseAction ()
		{
			type = TypeAction.chase;
		}
		
		public override MobAction nextAction(Mob mob, Fighter target){
			
			if (mob.isLeader() && mob.distanceAway() > maxbackrange){
				return new IdleAction();
			}
			
			if (!mob.isLeader() && mob.getLeader().distance(mob) > maxfollowrange){
				return new IdleAction();
			}
			
			
			if (mob.distance(target) > attackrange && mob.distance(target) < maxchaserange){ //continue chase condition
				return new ChaseAction();
			}
			
			
			
			return new IdleAction();
		}
	}
}

